package de.szut.sudoku.game.field;

import java.util.ArrayList;

/**
 * Class for a box on the sudoku field
 * 
 * @author Marc Huisinga
 * 
 */

public class Box {
	public static final int[] defaultStates = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };

	private int state;
	private ArrayList<Integer> availableStates;

	/**
	 * Resets the available states a box is able to have
	 */
	public void resetAvailableStates() {
		availableStates.clear();
		for (int currentState : defaultStates) {
			availableStates.add(currentState);
		}
	}

	public ArrayList<Integer> getAvailableStates() {
		return availableStates;
	}

	public void setAvailableStates(ArrayList<Integer> availableStates) {
		this.availableStates = availableStates;
	}

	public int getState() {
		return state;
	}

	public void setState(int state) {
		this.state = state;
	}

	public Box() {
		availableStates = new ArrayList<Integer>();
		state = 0;
		for (int currentState : defaultStates) {
			availableStates.add(currentState);
		}
	}

	public Box clone() {
		Box clone = new Box();
		clone.setAvailableStates(availableStates);
		clone.setState(state);
		return clone;
	}

	public boolean deepEquals(Box comp) {
		if (state != comp.getState()) {
			return false;
		}
		return true;
	}
}
